package com.joymeter.data.service;

import com.alibaba.otter.canal.client.CanalConnector;
import com.joymeter.common.utils.ConnectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Service;

import java.util.concurrent.Executors;

/**
 * @ClassName TaskService
 * @Description TODO
 * @Author liang
 * @Date 2018/10/12 17:52
 * @Version 1.0
 **/
@Service
public class TaskService implements ApplicationListener<ContextRefreshedEvent> {
    @Autowired
    private VlinkerService service;
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("==========================启动加载===================");
        Runnable appScheduler = () -> {

            service.connector();
        };
        Executors.newCachedThreadPool().execute(appScheduler);


    }


}
